package cn.xhy.material.dal.mysql.category;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.xhy.material.controller.admin.category.vo.CategoryPageReqVO;
import cn.xhy.material.dal.dataobject.category.CategoryDO;
import org.apache.ibatis.annotations.Mapper;
/**
 * 产品类别 Mapper
 *
 * @author xhy
 */
@Mapper
public interface CategoryMapper extends BaseMapperX<CategoryDO> {

    default PageResult<CategoryDO> selectPage(CategoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CategoryDO>()
                .likeIfPresent(CategoryDO::getName, reqVO.getName())
                .eqIfPresent(CategoryDO::getCategoryLevel, reqVO.getCategoryLevel())
                .eqIfPresent(CategoryDO::getParentId, reqVO.getParentId())
                .eqIfPresent(CategoryDO::getSort, reqVO.getSort())
                .eqIfPresent(CategoryDO::getSerialNo, reqVO.getSerialNo())
                .eqIfPresent(CategoryDO::getRemark, reqVO.getRemark())
                .eqIfPresent(CategoryDO::getType, reqVO.getType())
                .betweenIfPresent(CategoryDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CategoryDO::getId));
    }

}
